#include <REG52.H>
#include "Delay.h"
#include "motor.h"
#include "Key.h"
#include "UartInit.h"

sbit led1 = P3 ^ 7;
sbit led2 = P3 ^ 6;


unsigned char keyNum = 0;

void main(){    
    while (1)
    {
      Delay(10);
      keyNum = Key();
      led1 = keyNum > 0 ? 0 : 1;
      switch(keyNum){
            case 1:
               forward();
               break; 
            case 3:
               back();
               break; 
            case 2:
               goLeft();
               break; 
            case 4:
               goRight();
               break; 
            default :
               stop();
        }
    }
    
}
